<template>
  <div class="Delivery">
    <div class="filter_container">
      <el-form :model="Deliveryform" class="demo-form-inline">
        <!-- <el-form-item label="城市">
          <el-cascader :options="options" :props="{ multiple: true, checkStrictly: true }" clearable></el-cascader>
        </el-form-item> -->
        <div class="block">
          <span class="demonstration">多选选择任意一级选项</span>
      <div class="block">
        <span class="demonstration">单选选择任意一级选项</span>
        <el-cascader
          :options="options"
          :props="{ checkStrictly: true }"
          clearable></el-cascader>
      </div>
      <div class="block">
        <span class="demonstration">多选选择任意一级选项</span>
       <!-- <el-cascader
        :props="{ multiple: true, checkStrictly: true }"
          :options="options"

          clearable></el-cascader> -->
          <el-cascader
              :options="options"
              :props="{ checkStrictly: true,multiple: true,emitPath:false }"
              clearable></el-cascader>
      </div>
        </div>
        <el-form-item label="下单日期:">
          <el-date-picker v-model="Deliveryform.orderTime" size="small" type="date" style='width: 150px;margin-right: 15px;'
            placeholder="选择日期"></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" plain size="small" @click="handleFilter">查询</el-button>
          <el-button type="success" plain size="small" @click="handleExport"  onkeydown="if(event.keyCode==13){event.keyCode=0;event.returnValue=false;}">导出</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="Nationalorders-list">

      <el-table :data="DeliveryList" border style="width: 100%" show-summary :summary-method="getSummaries">
        <el-table-column label="配送订单数据" align='center'>
          <el-table-column label="后台单号" width="120" prop="address">
          </el-table-column>
          <el-table-column label="订单状态" width="120" prop="address">
          </el-table-column>
          <el-table-column label="送货地址" width="120" prop="number">
          </el-table-column>
          <el-table-column label="送货日期" width="120" prop="number">
          </el-table-column>
          <el-table-column label="送货时间" width="120" prop="number">
          </el-table-column>
          <el-table-column label="商品档案编码" width="120" prop="number">
          </el-table-column>
          <el-table-column label="蛋糕名称" width="120" prop="number">
          </el-table-column>
          <el-table-column label="规格" width="120" prop="number">
          </el-table-column>
          <el-table-column label="数量" width="120" prop="number">
          </el-table-column>
          <el-table-column label="数量" width="120" prop="number">
          </el-table-column>
        </el-table-column>
      </el-table>
    </div>

  </div>
</template>

<script>
  import {
    deptdepts
  } from "@/api/shop";
  export default {
    data() {
      return {
        Deliveryform: {
          orderTime: new Date(),
          city: ''
        },
        cityList: [], //城市
        DeliveryList: [ //全国订单数据
          {
            order: '1688470',
            status: '未确认',
            address: '福建省厦门市集美区杏林村苑中路219号',
            date: '2020-06-21 ',
            time: '09:00:00~09:00:00',
            skuid: '29067',
            name: '【限量特惠】榴芒双拼-2味慕斯',
            guige: '2磅（建议6-8人食用）',
            number: '12',
            orderer: '07525201314',
            delivery: '刘代红',
            Totalwarehouse: '',
            Subbin: '',
            submissionTime: "2020-06-18 16:59:31.0",
            createTime: "2020-06-18 16:59:31.0",
            operator: "范苗苗",
            city: '珠海市',
            Allocatetime: '2020-06-18 16:57:21',
          },
        ],
        options: [{
          value: 'zhinan',
          label: '指南',
          children: [{
            value: 'shejiyuanze',
            label: '设计原则',
            children: [{
              value: 'yizhi',
              label: '一致'
            }, {
              value: 'fankui',
              label: '反馈'
            }, {
              value: 'xiaolv',
              label: '效率'
            }, {
              value: 'kekong',
              label: '可控'
            }]
          }, {
            value: 'daohang',
            label: '导航',
            children: [{
              value: 'cexiangdaohang',
              label: '侧向导航'
            }, {
              value: 'dingbudaohang',
              label: '顶部导航'
            }]
          }]
        }, {
          value: 'zujian',
          label: '组件',
          children: [{
            value: 'basic',
            label: 'Basic',
            children: [{
              value: 'layout',
              label: 'Layout 布局'
            }, {
              value: 'color',
              label: 'Color 色彩'
            }, {
              value: 'typography',
              label: 'Typography 字体'
            }, {
              value: 'icon',
              label: 'Icon 图标'
            }, {
              value: 'button',
              label: 'Button 按钮'
            }]
          }, {
            value: 'form',
            label: 'Form',
            children: [{
              value: 'radio',
              label: 'Radio 单选框'
            }, {
              value: 'checkbox',
              label: 'Checkbox 多选框'
            }, {
              value: 'input',
              label: 'Input 输入框'
            }, {
              value: 'input-number',
              label: 'InputNumber 计数器'
            }, {
              value: 'select',
              label: 'Select 选择器'
            }, {
              value: 'cascader',
              label: 'Cascader 级联选择器'
            }, {
              value: 'switch',
              label: 'Switch 开关'
            }, {
              value: 'slider',
              label: 'Slider 滑块'
            }, {
              value: 'time-picker',
              label: 'TimePicker 时间选择器'
            }, {
              value: 'date-picker',
              label: 'DatePicker 日期选择器'
            }, {
              value: 'datetime-picker',
              label: 'DateTimePicker 日期时间选择器'
            }, {
              value: 'upload',
              label: 'Upload 上传'
            }, {
              value: 'rate',
              label: 'Rate 评分'
            }, {
              value: 'form',
              label: 'Form 表单'
            }]
          }, {
            value: 'data',
            label: 'Data',
            children: [{
              value: 'table',
              label: 'Table 表格'
            }, {
              value: 'tag',
              label: 'Tag 标签'
            }, {
              value: 'progress',
              label: 'Progress 进度条'
            }, {
              value: 'tree',
              label: 'Tree 树形控件'
            }, {
              value: 'pagination',
              label: 'Pagination 分页'
            }, {
              value: 'badge',
              label: 'Badge 标记'
            }]
          }, {
            value: 'notice',
            label: 'Notice',
            children: [{
              value: 'alert',
              label: 'Alert 警告'
            }, {
              value: 'loading',
              label: 'Loading 加载'
            }, {
              value: 'message',
              label: 'Message 消息提示'
            }, {
              value: 'message-box',
              label: 'MessageBox 弹框'
            }, {
              value: 'notification',
              label: 'Notification 通知'
            }]
          }, {
            value: 'navigation',
            label: 'Navigation',
            children: [{
              value: 'menu',
              label: 'NavMenu 导航菜单'
            }, {
              value: 'tabs',
              label: 'Tabs 标签页'
            }, {
              value: 'breadcrumb',
              label: 'Breadcrumb 面包屑'
            }, {
              value: 'dropdown',
              label: 'Dropdown 下拉菜单'
            }, {
              value: 'steps',
              label: 'Steps 步骤条'
            }]
          }, {
            value: 'others',
            label: 'Others',
            children: [{
              value: 'dialog',
              label: 'Dialog 对话框'
            }, {
              value: 'tooltip',
              label: 'Tooltip 文字提示'
            }, {
              value: 'popover',
              label: 'Popover 弹出框'
            }, {
              value: 'card',
              label: 'Card 卡片'
            }, {
              value: 'carousel',
              label: 'Carousel 走马灯'
            }, {
              value: 'collapse',
              label: 'Collapse 折叠面板'
            }]
          }]
        }, {
          value: 'ziyuan',
          label: '资源',
          children: [{
            value: 'axure',
            label: 'Axure Components'
          }, {
            value: 'sketch',
            label: 'Sketch Templates'
          }, {
            value: 'jiaohu',
            label: '组件交互文档'
          }]
        }]
      }
    },

    methods: {
      handlemyclass: function(row, column, rowIndex, columnIndex) {
        console.log(row, column, rowIndex, columnIndex);
        return 'test'
      },
      citydataList() {
        deptdepts("").then(response => {
          this.cityList = response.data.data;
        });
      },
      handleFilter() { //查询

      },
      handleExport() { //导出

      },
      getSummaries(param) {
        const {
          columns,
          data
        } = param;
        const sums = [];
        columns.forEach((column, index) => {
          if (index === 0) {
            sums[index] = '总计';
            return;
          }
          const values = data.map(item => Number(item[column.property]));
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                return prev + curr;
              } else {
                return prev;
              }
            }, 0);
            // sums[index] += ' 元';
          } else {
            // sums[index] = 'N/A';
          }
        });

        return sums;
      }
    }
  }
</script>

<style lang='scss'>

  .Delivery {
    padding-top: 20px;
    border-top: 1px solid #ccc;

    .filter_container {
      display: flex;
      .el-form-item {
        margin-bottom: 22px !important;
      }
    }
  }
</style>
